
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
       <title>书籍列表</title>
       <meta name="viewport" content="width=device-width, initial-scale=1.0">
       <!-- 引入 Bootstrap -->
       <link href="${pageContext.request.contextPath}/statics/css/bootstrap.min.css" rel="stylesheet">

    <style>
           .form-control{
               width: 70% !important;
           }
           .float-left{
               float: left;
           }
           .float-right{
               float: right;
           }
           .warning{
               font-size: 28px;
               color: lightcoral;
           }
           .m-l{
               margin-left: 20px;
           }
           .fx{
               display: flex;
               justify-content: space-between;
           }
           .h-34{
               height: 34px;
               margin-top: 15px;
           }
       </style>

</head>
<body>

<%--row clearfix表示不受其他样式控制,清除浮动--%>
<div class="container">

    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header fx">
                <h1>
                    <small>书籍列表　————————　显示所有书籍</small>
                </h1>
                <a class="btn btn-default m-l h-34" href="${pageContext.request.contextPath}/Out">退出登录</a>
            </div>
        </div>

        <div class="row fix">
            <div class="col-md-4 column float-left">
                <a class="btn btn-default m-l" href="${pageContext.request.contextPath}/book/toAddBook">新增书籍</a>
                <a class="btn btn-default" href="${pageContext.request.contextPath}/book/allBook">全部书籍</a>
            </div>
            <div class="col-md-3 column float-right">
                <form action="${pageContext.request.contextPath}/book/queryBook" method="post" class="form-inline">
                    <input type="text" id="queryBookName" name="queryBookName" class="form-control" placeholder="请输入要查询的书籍">
                    <input id="querySubit" type="submit" class="btn btn-default" value="查询">
                </form>
            </div>
        </div>
    </div>

    <div class="row clearfix">
        <div class="col-md-12 column">
            <table class="table table-hover table-striped">
                <thead>
                <tr>
                    <th>书籍编号</th>
                    <th>书籍名称</th>
                    <th>书籍数量</th>
                    <th>书籍详情</th>
                    <th>操作</th>
                </tr>
                </thead>


            <%--书籍从数据库中查询出来,从这个List中遍历出来: foreach--%>
                <tbody>
                <c:forEach var="book" items="${list}">
                    <tr>
                        <td>${book.bookID}</td>
                        <td>${book.bookName}</td>
                        <td>${book.bookCounts}</td>
                        <td>${book.detail}</td>
                        <td>
                            <%--<a href="${pageContext.request.contextPath}/book/toUpdateBook?id=${book.getBookID()}">修改</a>--%>
                            <a href="${pageContext.request.contextPath}/book/toUpdateBook?id=${book.bookID}">修改</a>
                            &nbsp;|&nbsp;
                            <a href="${pageContext.request.contextPath}/book/deleteBook/${book.bookID}">删除</a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
            <span class="warning">${warning}</span>
        </div>
    </div>
</div>

</body>